import 'package:route/route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo2/pages.dart';

class Page1 extends StatelessWidget {
  final String? name;
  final int? age;

  const Page1({Key? key, this.name, this.age}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("page1")),
      body: Container(
        alignment: Alignment.center,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text("name: $name, age $age"),
            ElevatedButton(
                onPressed: () {
                  router.popPagesUntil(context, FlutterPages.appEntryPage);
                },
                child: const Text("pop until appEntry"))
          ],
        ),
      ),
    );
  }
}
